<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="js/vue.js"></script>
</head>
<body>
    <div id="root">
        <h1>我的大名：{{name}}</h1>
        <h1>我的头衔：{{head}}</h1>
        <h1>直辖数  ：{{i}}</h1>

    </div>
    <script type="text/javascript">
        let number = 70
        let person = {
            name:'cb',
            high:'183',
        }

        Object.defineProperty(person,'age',{
            // value:18
            get(){
                console.log('有人读取age属性了')
                return number
            },

            //当有人修改person的age属性时，set函数(setter)就会被调用，且会收到修改的具体值
            set(value){
                console.log('有人修改了age属性，且值是',value)
                number = value
            }
        })
        console.log(person)
    </script>
</body>

<script type="text/javascript">
    new Vue({
        el:'#root',
        data:{
            name:'陈邦',
            head:'法兰克国王',
            i:'1'
        }
    })
</script>
</html>